Skip to content

Allow Client#call_tool to accept a tool name#266

Merged
koic merged 1 commit intomodelcontextprotocol:mainfrom
koic:allow_client_call_tool_to_accept_a_tool_name
Mar 23, 2026
Merged

Allow Client#call_tool to accept a tool name#266
koic merged 1 commit intomodelcontextprotocol:mainfrom
koic:allow_client_call_tool_to_accept_a_tool_name

Conversation

@koic
Copy link
Member

@koic koic commented Mar 22, 2026

Motivation and Context

Client#call_tool previously required an MCP::Client::Tool object to call a tool. This made the API harder to use compared to other MCP SDK implementations, which accept a tool name string directly:

How Has This Been Tested?

Updated existing tests and added new tests.

Breaking Change

No. This change adds a name: parameter so callers can pass a tool name string directly without looking up a Tool object first. The existing tool: parameter continues to work for backward compatibility.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

## Motivation and Context

`Client#call_tool` previously required an `MCP::Client::Tool` object to call a tool.
This made the API harder to use compared to other MCP SDK implementations,
which accept a tool name string directly:

- Python SDK: `session.call_tool(name, arguments)` accepts a name string.
  https://github.com/modelcontextprotocol/python-sdk/blob/v1.26.0/src/mcp/client/session.py#L370
- TypeScript SDK: `client.callTool({ name, arguments })` accepts a name string.
  https://github.com/modelcontextprotocol/typescript-sdk/blob/ccb78f2/packages/client/src/client/client.ts#L834

## How Has This Been Tested?

Updated existing tests and added new tests.

## Breaking Change

No. This change adds a `name:` parameter so callers can pass a tool name string
directly without looking up a `Tool` object first. The existing `tool:` parameter
continues to work for backward compatibility.
@koic koic merged commit ccddd87 into modelcontextprotocol:main Mar 23, 2026
11 checks passed
@koic koic deleted the allow_client_call_tool_to_accept_a_tool_name branch March 23, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants